<!DOCTYPE html>
<html> 
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>yukari world</title>
    <#include "/lib/base_source.ftl">
      <style type="text/css">
      </style>
  </head> 
  <body>
    <div class='whole-container'>
      <#include "/lib/header.ftl">
        <div>
          <ul class="breadcrumb">
            <li>投票管理</li><span class="divider">/</span>
            <li>投票</li>
          </ul>
        </div>
        <div class="container-fluid">
          <div class="row-fluid">
            <div class="container span12">
              <#include "/lib/alert.ftl">
                 <div class='main-content'>
                    <div class="well form-horizontal">
                        <div class='main-action'>
                        	<form id="voteForm" method="post" action="${rc.contextPath}/admin/vote/startVote">
                    		<div class="control-group">
                                <label class="control-label">标题</label>
                                <div class="controls">
                                    <input type="text" name="name" value="" style="width:300px" placeholder="给这次投票取个名字"/>
                                </div>
                            </div>
                    		<div class="control-group" id="operate">
                                <label class="control-label"></label>
                                <div class="controls">
                                    <a href="javascript:addVoteItem()" class="btn btn-info btn-sm">增加选项</a>
                                    <a href="javascript:$('#voteForm').submit()" class="btn btn-info btn-sm">开始投票</a>
                                </div>
                            </div>
                            </form>
                        </div>
                    </div> 
                    
                    <div class="table-content">
                    <#-- table -->
                        <table class="table-striped table-condensed table-hover" id="itemTable" style="width: 100%;max-width: 100%;margin-bottom: 20px;font-size:12px;word-break:break-all;word-wrap:break-word;">
                        	<#if list??>
                        	<thead>
                        	<tr>
                        		<th>编号</th>
                        		<th>投票标题</th>
                        		<th>开始时间</th>
                        		<th>结束时间</th>
                        		<th></th>
                        	</tr>
                        	</thead>
                        	 <tbody>
                            <#list list as item>
                            	<tr>
                                	<td>${item.id?c}</td>
                                	<td>${item.name}</td>
                                	<td>${item.startTime?string("yyyy-MM-dd HH:mm:ss")}</td>
                                	<td>${item.endTime?string("yyyy-MM-dd HH:mm:ss")}</td>
                                	<td>
                                		<a href="javascript:getDetail(${item.id?c})" class="btn btn-info btn-sm">查看详情</a>
                                	</td>
                                </tr>
                            </#list>
                            </#if>
                             </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
  <script>
    $(document).ready(function() {
	});
	
	function addVoteItem(){
		$("#operate").before('<div class="control-group"><label class="control-label"></label><div class="controls"><input type="text" name="keys" value="" style="width:100px"/>关键字&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="notes" value="" style="width:200px"/>备注</div></div>');
	}
	
	function getDetail(id){
		location.href = "${rc.contextPath}/admin/vote/getVoteDetail?groupId="+id;
	}
	
		
   </script>
</body>
</html>